package cn.wolfcode.trip.base.domain;

import cn.wolfcode.trip.base.util.JSONUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
public class Hotel extends BaseDomain {

    private String name;//酒店名称

    private String printUrl;//酒店图片

    private Double price;//价钱

    private Integer level;//星级

    private Integer state;//类型

    private String address;//地址

    private Region place;//地区

    public static final Integer STATE_OUT = 0; //下架
    public static final Integer STATE_COMMEND = 1; //发布

    public static final Integer LEVEL_ONE = 1;
    public static final Integer LEVEL_TWO= 2;
    public static final Integer LEVEL_THREE = 3;
    public static final Integer LEVEL_FOUR= 4;
    public static final Integer LEVEL_FIVE = 5;
    public String getStateName(){
        String msg = "下架";
        if (state == STATE_COMMEND){
            msg = "发布";
        }
        return msg;
    }

    public String getLevelName(){
        String msg = "一星级";
        if (level == LEVEL_TWO){
            msg = "二星级";
        } else if (level == LEVEL_THREE){
            msg = "三星级";
        } else if (level == LEVEL_FOUR){
            msg = "四星级";
        } else if (level == LEVEL_FIVE){
            msg = "五星级";
        }
        return msg;
    }

    public String getJson(){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("printUrl",printUrl);
        map.put("price",price);
        map.put("level",level);
        map.put("state",state);
        map.put("address",address);
        if(place != null){
            map.put("placeId",place.getId());
        }
        return JSONUtil.toJSONString(map);
    }





}
